﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using WebReference;
using Session;
using PrimaryKeyFunction;

public partial class Admin_SelectExperiment : System.Web.UI.Page
{
    
        Service objService = new Service();
        Functions objFunction = new Functions();
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
        }
        else
        {
            fillDataGrid();
        }
    }

    

    private void fillDataGrid()
    {
        string RefeId = (string)Session["ReferenceId"];
        if (objService.GetExperiment(RefeId).Tables[0].Rows.Count < 1)
        {
            trButton .Visible = true;
            lblMessage.Text = "You don't have the Experiments for this reference,please click over the add experiment button";
                      
        }
        else
        {
            dgExperiment.DataSource = objService.GetExperiment(RefeId).Tables[0];
            dgExperiment.DataBind();
        }
    }

   
  
    protected void dgExperiment_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        dgExperiment.PageIndex = e.NewPageIndex;
        fillDataGrid();
    }
    protected void btnAddExperiment_Click1(object sender, EventArgs e)
    {
        Response.Redirect("Experiment.aspx");
    }
}

